/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.edu.fatec.ads.classes;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Transient;

/**
 *
 * @author BRUNO
 */
@Entity
public class Estado extends AbstractTO{

    private String sigla;
    private String descricao;

    public Estado(){ }

    /**
     * @return the sigla
     */
    @Id
    @Column(name="sg_estado", length=2)
    public String getSigla() {
        return sigla;
    }

    /**
     * @param sigla the sigla to set
     */
    public void setSigla(String sigla) {
        this.sigla = sigla;
    }

    /**
     * @return the descricao
     */
    @Column(name="nm_estado", length=30, nullable=false)
    public String getDescricao() {
        return descricao;
    }

    /**
     * @param descricao the descricao to set
     */
    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    @Override
    @Transient
    public Serializable getPK() {
        return this.getSigla();
    }

    @Override
    public void setPK(Serializable identifier) {
        this.setSigla((String) identifier);
    }

    @Override
    public String toString() {
        return "Estado[sigla=" + this.getSigla() +
                        ", descricao=" + this.getDescricao()+ "]";
    }

}